package DAOImp;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import DAO.AbsHbnDao;
import DAO.ProductDAO;
import POJO.Product;

@Repository
public class HbnProductDao extends AbsHbnDao<Product> implements ProductDAO {

	private static final String FIND_PRODUCT_BY_TAG = "FROM Product P WHERE P.tag like :tag";
	
	@SuppressWarnings("unchecked")
	public List<Product> getAllProductByTag(String searchString) {
		Query query = getSession().createQuery(FIND_PRODUCT_BY_TAG).setParameter("tag", "%" + searchString + "%");
		return query.list();
	}
	
}
